package cc.cix.hq.common.core.entity;

import lombok.Data;
import lombok.experimental.Accessors;

/**
 * @author cix
 */
@Data
@Accessors(chain = true)
public class Result<T> {

    private static final long serialVersionUID = -8713837118340960775L;


    /**
     * 错误信息(失败时有)
     */
    private String message;

    /**
     * 返回数据
     */
    private T data;

    public static <T> Result<T> success() {
        return success(null);
    }

    public static <T> Result<T> success(T data) {
        return new Result<T>().setData(data);
    }

    public static <T> Result<T> fail(String message) {
        return new Result<T>().setMessage(message);
    }

}
